﻿package plugin.viproot
{
    import flash.display.*;
    import morn.core.components.*;
    import plugin.component.view.*;

    public class VipShowImg extends Sprite
    {
        private var bgimg:Image;
        private var _data:Object;
        private var sp:Sprite;
        private var cfgMonsters:Array;
        private var bossModel1:RoleShow;
        private var fsImg:UrlImage;

        public function VipShowImg()
        {
            this.cfgMonsters = ConfigDictionary.data.monster;
            if (this._data == null)
            {
                this._data = new Object();
            }
            this.bgimg = new Image();
            this.bgimg.x = -102;
            this.bgimg.y = -62;
            this.bgimg.scaleX = 0.7;
            this.bgimg.scaleY = 0.7;
            this.addChild(this.bgimg);
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            this._data = param1;
            if (this.sp)
            {
                this.sp.parent.removeChild(this.sp);
                this.sp = null;
            }
            if (this.bossModel1)
            {
                this.bossModel1.parent.removeChild(this.bossModel1);
                this.bossModel1.destroy();
                this.bossModel1 = null;
            }
            if (this.fsImg)
            {
                this.fsImg.parent.removeChild(this.fsImg);
                this.fsImg.dispose();
                this.fsImg = null;
            }
            this.showFS();
            this.setExpImg();
            this.setAttJC();
            this.count();
            this.jydCount();
            return;
        }// end function

        private function setExpImg() : void
        {
            var _loc_1:String = null;
            var _loc_2:Image = null;
            var _loc_3:int = 0;
            var _loc_4:Image = null;
            if (this._data.exp)
            {
                _loc_1 = "" + this._data.exp;
                this.sp = new Sprite();
                _loc_2 = new Image();
                _loc_2.url = "png.vipnum.11";
                var _loc_5:Number = 0.7;
                _loc_2.scaleY = 0.7;
                _loc_2.scaleX = _loc_5;
                _loc_2.x = 0;
                this.sp.addChild(_loc_2);
                _loc_3 = _loc_1.length - 1;
                while (_loc_3 >= 0)
                {
                    
                    _loc_4 = new Image();
                    _loc_4.url = "png.vipnum." + _loc_1.charAt(_loc_3);
                    var _loc_5:Number = 0.7;
                    _loc_4.scaleY = 0.7;
                    _loc_4.scaleX = _loc_5;
                    this.sp.addChild(_loc_4);
                    _loc_4.x = (_loc_3 - _loc_1.length) * 20;
                    _loc_4.y = 0;
                    _loc_3 = _loc_3 - 1;
                }
                this.addChild(this.sp);
                this.sp.x = 70;
                this.sp.y = 0;
            }
            return;
        }// end function

        private function setAttJC() : void
        {
            var _loc_1:String = null;
            var _loc_2:int = 0;
            var _loc_3:Image = null;
            var _loc_4:Image = null;
            if (this._data.att)
            {
                _loc_1 = "" + this._data.att;
                this.sp = new Sprite();
                _loc_2 = _loc_1.length - 1;
                while (_loc_2 >= 0)
                {
                    
                    _loc_4 = new Image();
                    _loc_4.url = "png.vipnum." + _loc_1.charAt(_loc_2);
                    var _loc_5:Number = 0.7;
                    _loc_4.scaleY = 0.7;
                    _loc_4.scaleX = _loc_5;
                    this.sp.addChild(_loc_4);
                    _loc_4.x = (_loc_2 - (_loc_1.length - 1)) * 20;
                    _loc_4.y = 0;
                    _loc_2 = _loc_2 - 1;
                }
                _loc_3 = new Image();
                _loc_3.url = "png.vipnum.12";
                var _loc_5:Number = 0.7;
                _loc_3.scaleY = 0.7;
                _loc_3.scaleX = _loc_5;
                _loc_3.x = (-_loc_1.length) * 20;
                _loc_3.y = 0;
                this.sp.addChild(_loc_3);
                this.addChild(this.sp);
                this.sp.x = 75;
                this.sp.y = 0;
            }
            return;
        }// end function

        private function count() : void
        {
            var _loc_1:String = null;
            var _loc_2:int = 0;
            var _loc_3:Image = null;
            if (this._data.count)
            {
                _loc_1 = "" + this._data.count;
                this.sp = new Sprite();
                _loc_2 = _loc_1.length - 1;
                while (_loc_2 >= 0)
                {
                    
                    _loc_3 = new Image();
                    _loc_3.url = "png.vipnum." + _loc_1.charAt(_loc_2);
                    var _loc_4:Number = 0.7;
                    _loc_3.scaleY = 0.7;
                    _loc_3.scaleX = _loc_4;
                    this.sp.addChild(_loc_3);
                    _loc_3.x = (_loc_2 - _loc_1.length + 1) * 20;
                    _loc_3.y = 0;
                    _loc_2 = _loc_2 - 1;
                }
                this.addChild(this.sp);
                this.sp.x = 75;
                this.sp.y = 0;
            }
            return;
        }// end function

        private function jydCount() : void
        {
            var _loc_1:String = null;
            var _loc_2:Image = null;
            var _loc_3:int = 0;
            var _loc_4:Image = null;
            if (this._data.jyd)
            {
                _loc_1 = "" + this._data.jyd;
                this.sp = new Sprite();
                if (this._data.jyd == "无限")
                {
                    _loc_2 = new Image();
                    _loc_2.url = "png.vipnum.10";
                    var _loc_5:Number = 0.7;
                    _loc_2.scaleY = 0.7;
                    _loc_2.scaleX = _loc_5;
                    this.sp.addChild(_loc_2);
                    this.sp.x = 50;
                    this.sp.y = 0;
                }
                else
                {
                    _loc_3 = _loc_1.length - 1;
                    while (_loc_3 >= 0)
                    {
                        
                        _loc_4 = new Image();
                        _loc_4.url = "png.vipnum." + _loc_1.charAt(_loc_3);
                        var _loc_5:Number = 0.7;
                        _loc_4.scaleY = 0.7;
                        _loc_4.scaleX = _loc_5;
                        this.sp.addChild(_loc_4);
                        _loc_4.x = (_loc_3 - _loc_1.length + 1) * 20;
                        _loc_4.y = 0;
                        _loc_3 = _loc_3 - 1;
                    }
                    this.sp.x = 75;
                    this.sp.y = 0;
                }
                this.addChild(this.sp);
            }
            return;
        }// end function

        private function showFS() : void
        {
            var _loc_1:int = 0;
            var _loc_2:int = 0;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            if (this._data.fsid)
            {
                this.fsImg = new UrlImage();
                this.fsImg.url = "cs2_viproot/f" + this._data.imgurl + ".png";
                this.fsImg.x = 23;
                this.fsImg.y = 25;
                var _loc_5:Number = 0.7;
                this.fsImg.scaleY = 0.7;
                this.fsImg.scaleX = _loc_5;
                _loc_1 = 0;
                _loc_2 = 0;
                _loc_3 = ConfigDictionary.data.monsterArms[int(this._data.fsid)];
                if (_loc_3 == null)
                {
                    _loc_1 = 0;
                }
                else
                {
                    _loc_2 = _loc_3.wing;
                    _loc_1 = _loc_3.weapon;
                }
                _loc_4 = {1:{model:_loc_1}};
                this.bossModel1 = new RoleShow(this.cfgMonsters[this._data.fsid].model, 3, _loc_4, _loc_2, null);
                var _loc_5:Number = 0.5;
                this.bossModel1.scaleX = 0.5;
                this.bossModel1.scaleY = _loc_5;
                this.addChild(this.bossModel1);
                this.addChild(this.fsImg);
                this.bossModel1.x = 60;
                this.bossModel1.y = 80;
            }
            return;
        }// end function

        public function set bg(param1:String) : void
        {
            this.bgimg.url = param1;
            return;
        }// end function

    }
}
